using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace IReaper.CourseData
{
    public partial class CourseProperties : Form
    {
        public CourseProperties(Course Course)
            : this()
        {
            this.propertyVideo.File = Course.Video;
            this.propertyQA.File = Course.QA;
            this.propertyDoc.File = Course.PPT;
            this.propertyCode.File = Course.Code;
            this.propertyMP3.File = Course.MP3;
            this.propertyMP4.File = Course.MP4;
            this.propertyWMV.File = Course.WMV;
            this.label1.Text = Course.Headline;
        }

        public CourseProperties()
        {
            InitializeComponent();
        }

        private void Ok(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void Cancel(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            if (this.DialogResult == DialogResult.OK)
            { 
                //commite all changes.
                this.propertyCode.CommiteChange();
                this.propertyDoc.CommiteChange();
                this.propertyVideo.CommiteChange();
                this.propertyQA.CommiteChange();
                this.propertyMP3.CommiteChange();
                this.propertyMP4.CommiteChange();
                this.propertyWMV.CommiteChange();
            }
        }

    }
}